# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer: Haelwenn (lanodan) Monnier <contact+alpine@hacktivis.me>
pkgname=gumbo-parser
pkgver=0.12.1
pkgrel=0
pkgdesc="An HTML5 parsing library in pure C99"
url="https://codeberg.org/grisha/gumbo-parser"
arch="all"
license="Apache-2.0"
makedepends="libtool m4 automake autoconf gtest-dev"
checkdepends="gtest"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://codeberg.org/grisha/gumbo-parser/archive/$pkgver.tar.gz"
builddir="$srcdir/gumbo-parser"

prepare() {
	default_prepare
	./autogen.sh
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make -k check
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm 644 -t "$pkgdir/usr/share/licenses/$pkgname/" doc/COPYING
	install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
}

sha512sums="
54ee47eea25b527b8708615c7729ee4b57108e6e210b649508951c83bd5cb08a894849327d1da8e5cf831b9700cceb2f168cea86f2f68e37633f8b773d9815fd  gumbo-parser-0.12.1.tar.gz
"
